from PyQt5.Qt import *
from resource.book_tickets import Ui_Form


class BookPanel(QWidget, Ui_Form):
    confirmSignal = pyqtSignal(dict)
    cancelSignal=pyqtSignal()

    def __init__(self, parent=None, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        self.setAttribute(Qt.WA_StyledBackground, True)
        self.setupUi(self)

    def confirm(self):
        zw = self.buttonGroup.checkedButton().property("val")
        phone_num = self.phone_le.text()
        print(zw, phone_num)
        self.confirmSignal.emit({"zw": zw, "phone_num": phone_num})

    def cancelQuery(self):
        self.cancelSignal.emit()


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    window = BookPanel()
    window.show()
    sys.exit(app.exec_())
